﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DBHelper;
using BusinessLayer.FindArtInfo.Entities;
using System.Data.SqlClient;
using System.Data;

namespace BusinessLayer.FindArtInfo
{
    public class ArtistHomeBL
    {        
        public ArtistHome GetRandom()
        {
            var adapter = new BaseDAO(DbConfig.DbFindArtInfoConnectionString);
            var list = adapter.GetList<ArtistHome>("sp_ArtistHome_Select_Random", CommandType.StoredProcedure,
                                                   CustomConnectionState.CloseOnExit);
            return list.FirstOrDefault(); 
        }

        public ArtistHome GetById(int id)
        {
            var adapter = new BaseDAO(DbConfig.DbFindArtInfoConnectionString);
            adapter.AddParameter("@Id", id);
            var list = adapter.GetList<ArtistHome>("sp_ArtistHome_GetById", CommandType.StoredProcedure,
                                                   CustomConnectionState.CloseOnExit);
            return list.FirstOrDefault();
        }
    }
}
